//
//  UserDefaultsViewController.swift
//  DateUsage
//
//  Created by YJH on 2025/5/24.
//

import UIKit

class UserDefaultsViewController: UIViewController {
    
    let key: String = "userAccount"
    let key1: String = "balance"
    
    override func viewDidLoad() {
        super.viewDidLoad()
//        save()
        fetch()
    }
    
    func fetch() {
        let account = UserDefaults.standard.string(forKey: key)
        let balance = UserDefaults.standard.double(forKey: key1)
        print(account, balance)
    }
    
    func save() {
        UserDefaults.standard.setValue("Liming", forKey: key)
        UserDefaults.standard.setValue(1000, forKey: key1)
    }
    
}
